package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.KpiMtbfDao;
import com.sugon.entity.KpiMtbfEntity;
import com.sugon.service.KpiMtbfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * KPI中产线MTBF统计，原则上第二天凌晨统计前一天的Service实现类
 *
 * @author sugon
 * @date 2020-07-18 19:43:52
 */
@Service("kpiMtbfService")
public class KpiMtbfServiceImpl implements KpiMtbfService {
    @Autowired
    private KpiMtbfDao kpiMtbfDao;

    @Override
    public KpiMtbfEntity queryObject(String id) {
        return kpiMtbfDao.queryObject(id);
    }

    @Override
    public List<KpiMtbfEntity> queryList(Map<String, Object> map) {
        return kpiMtbfDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return kpiMtbfDao.queryTotal(map);
    }

    @Override
    public int save(KpiMtbfEntity kpiMtbf) {
        kpiMtbf.setId(RandomUtil.randomString(32));
        kpiMtbf.setGmtCreate(DateUtil.date());
        return kpiMtbfDao.save(kpiMtbf);
    }

    @Override
    public int update(KpiMtbfEntity kpiMtbf) {
        return kpiMtbfDao.update(kpiMtbf);
    }

    @Override
    public int delete(String id) {
        return kpiMtbfDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return kpiMtbfDao.deleteBatch(ids);
    }
}
